CXX = g++
GNAT = gnatmake
CXXFLAGS=-Wall -ansi
LDFLAGS=-Wall -ansi  -lpthread -lstdc++ -lgcc_s 
EXEC=main.exe
BIN = operatingcenter.o interface_ada.o
BINADA = main.o gestionnaire.o data_library.o maintest.o buses.o
ALI = main.ali gestionnaire.ali buses.ali data_library.ali interface_cpp.ali

all: clean $(EXEC)

$(EXEC) :  $(BIN) $(ALI)
	gnatbind -x main.ali
	gnatlink main.ali -g $(BIN) -o $(EXEC) $(LDFLAGS) --LINK=c++

##################
#       Partie C++
##################

interface_ada.o: interface_ada.cpp
	$(CXX) -o interface_ada.o -c interface_ada.cpp $(CFLAGS)
	
operatingcenter.o: operatingcenter.cpp data_library.hpp interface_ada.hpp
	$(CXX) -o operatingcenter.o -c operatingcenter.cpp $(CXXFLAGS)
	
##################
#       Partie ADA
##################

data_library.ali : data_library.ads 
	$(GNAT) -c data_library.ads
	
interface_CPP.ali : interface_CPP.ads 
	$(GNAT) -c interface_CPP.ads	

buses.ali : buses.ads
	$(GNAT) -c buses.ads
	
gestionnaire.ali : gestionnaire.adb
	$(GNAT) -c gestionnaire.adb
	
main.ali : main.adb
	$(GNAT) -c main.adb
		
clean:
	rm -rf *.o
	rm -rf *.ali
	rm -rf *~*.ad*
	rm -rf bus*.html
	rm -rf arret*.html
	
mr_propre:
	rm -rf *.o
	rm -rf *.ali
	rm -rf *~*.ad*
	rm -f main.exe

tar:
	tar -cvf bus.tar Makefile *.ads *.adb *.hpp *.cpp *.gif *.jpg
